From: Jasper St. Pierre Date: Wed, 3 Jul 2013 17:47:21 +0000 (-0400) Subject: network: Fix a recursion issue when updating VPN X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3990 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=ccba18aa8fb102644eb7d756ff3aaccd6f597cef;p=gnome-shell.git network: Fix a recursion issue when updating VPN _updateIcon should not attempt to sync any active connections, as the icon-changed signal can be emitted in response to something done during _syncActiveConnection. In the case of VPN, removeActiveConnection would cause an icon-changed signal to be emitted immediately, but the state would not be updated, causing us to call removeActiveConnection over and over. Explicitly sync all active connections when we know it needs to be done, and simply make _updateIcon synchronize with the current device's icon. https://bugzilla.gnome.org/show_bug.cgi?id=703565 --- diff --git a/js/ui/status/network.js b/js/ui/status/network.js index 923aaeaf4..6cc9055ba 100644 --- a/js/ui/status/network.js +++ b/js/ui/status/network.js @@ -1528,7 +1528,7 @@ const NMApplet = new Lang.Class({ this._client.connect('notify::manager-running', Lang.bind(this, this._syncNMState)); this._client.connect('notify::networking-enabled', Lang.bind(this, this._syncNMState)); this._client.connect('notify::state', Lang.bind(this, this._syncNMState)); - this._client.connect('notify::active-connections', Lang.bind(this, this._updateIcon)); + this._client.connect('notify::active-connections', Lang.bind(this, this._syncActiveConnections)); this._client.connect('device-added', Lang.bind(this, this._deviceAdded)); this._client.connect('device-removed', Lang.bind(this, this._deviceRemoved)); this._settings.connect('new-connection', Lang.bind(this, this._newConnection)); @@ -1761,8 +1761,8 @@ const NMApplet = new Lang.Class({ let a = this._activeConnections[i]; if (!a._inited) { - a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._updateIcon)); - a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._updateIcon)); + a._notifyDefaultId = a.connect('notify::default', Lang.bind(this, this._syncActiveConnections)); + a._notifyDefault6Id = a.connect('notify::default6', Lang.bind(this, this._syncActiveConnections)); a._notifyStateId = a.connect('notify::state', Lang.bind(this, this._notifyActivated)); a._inited = true; @@ -1814,6 +1814,7 @@ const NMApplet = new Lang.Class({ if (this._mainConnection) { let dev = this._mainConnection._primaryDevice; this._mainConnectionIconChangedId = dev.connect('icon-changed', Lang.bind(this, this._updateIcon)); + this._updateIcon(); } }, @@ -1824,7 +1825,7 @@ const NMApplet = new Lang.Class({ activeConnection._primaryDevice._notification = null; } - this._updateIcon(); + this._syncActiveConnections(); }, _ignoreConnection: function(connection) { @@ -1861,7 +1862,7 @@ const NMApplet = new Lang.Class({ _newConnection: function(settings, connection) { this._addConnection(connection); - this._updateIcon(); + this._syncActiveConnections(); }, _connectionRemoved: function(connection) { @@ -1940,11 +1941,10 @@ const NMApplet = new Lang.Class({ } this._showNormal(); - this._updateIcon(); + this._syncActiveConnections(); }, _updateIcon: function() { - this._syncActiveConnections(); let hasApIcon = false; let hasMobileIcon = false;